home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / CURSOR.SWG / 0018_ASM Cursor Position.pas < prev    next >
Pascal/Delphi Source File  |  1993-11-02  |  1KB  |  47 lines

  1. {
  2. JEFF HLYWA
  3.  
  4. > One more thing, how could I reWrite the GotoXY command For use
  5. > through the comport?
  6.  
  7. Ok.. if you are using the Fossil Driver routines you can do this.
  8. }
  9.  
  10. Procedure SetCursorPos(XPos, Ypos : Byte); Assembler;
  11. Asm
  12.   SUB  XPos, 1     { Subtract 1 from X Position }
  13.   SUB  YPos, 1                  { Subtract 1 from Y Position }
  14.   MOV  AH, $11
  15.   MOV  DH, YPos
  16.   MOV  DL, XPos
  17.   INT  14h
  18. end;
  19.  
  20. { We subtracted 1 from both the X Position and Y Position because when you
  21. use the SetCursorPos the orgin ( upper left hand corner ) coordinates are
  22. 0,0. Using the GotoXY the orgin coordinates are 1,1.  For example : if we
  23. wanted to GotoXY (40,12) using the SetCursorPos Without the subtraction
  24. commands the cursor would be located at (41,13).  Pretty simple }
  25.  
  26. { The follow Procedure gets the current cusor postion }
  27.  
  28. Procedure GetCursorPos;
  29. { Returns then X Coordinate and Y Coordinate (almost like WhereX and WhereY).
  30. You must define X and Y as an Integer or Byte in the Var section of your
  31. Program }
  32. Var
  33.   XCord,
  34.   YCord : Byte;          { Use temporary coordinates }
  35. begin
  36.   Asm
  37.     MOV  AH, $12
  38.     INT  14h
  39.     MOV  YCord, DH
  40.     MOV  XCord, DL
  41.     ADD  YCord, 1  { Add 1 to the Y Coordinate }
  42.   end;
  43.   X := XCord;             { Set X and Y }
  44.   Y := YCord;
  45. end;
  46.  
  47.